package com.lora.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum WirelessSmokeFeelEnum {

    STATUS1("01H", "火警", "020100"),
    STATUS2("02H", "传感器故障", "020200"),
    STATUS3("03H", "电池低电压", "020300"),
    STATUS4("04H", "火警消除", "020400"),
    STATUS5("05H", "传感器故障消除", "020500"),
    STATUS6("06H", "低电压恢复", "020600"),
    STATUS7("00H", "正常状态", "020000"),
    STATUS8("0EH", "探测器上电", "020E00"),
    STATUS9("0DH", "按键自检", "020D00");

    private String hex;
    private String title;
    private String reserve;

    WirelessSmokeFeelEnum(String hex, String title, String reserve) {
        this.hex = hex;
        this.title = title;
        this.reserve = reserve;
    }

    public static WirelessSmokeFeelEnum getStatusByPre2bit(String reserve) {
        return Arrays.stream(WirelessSmokeFeelEnum.values()).filter(v -> v.getReserve().equals(reserve)).findAny().orElse(null);
    }

}
